<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>初始vue</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="root">
    <button @click="updateFirst">点我更新第一个数据</button>
    <ul>
      <li v-for="item in person">
        {{item.name}} - {{item.age}}
      </li>
    </ul>
  </div>
  <script>
    Vue.config.productionTip = false
    //创建vue实例
    const vm = new Vue({
      el: '#root',
      data: {
        person: [
          {id:'001',name:'小花',age:18},
          {id:'002',name:'小花1',age:120},
          {id:'003',name:'小花2',age:15}
        ],
        school:{
          addr:'四川',
          name:'哈哈'
        }
      },
      methods:{
        updateFirst(){
          this.person[0] = {id:'001',name:'小花6',age:182}
        }
      }
    })
  </script>
</body>

</html>